<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../css/index.css"/>
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/vant.min.js" type="text/javascript" charset="utf-8"></script>		
		<script src="../js/ajax.js" type="text/javascript" charset="utf-8"></script>
		<script src="html5plus://ready"></script>
		<script src="../js/back.js" type="text/javascript" charset="utf-8"></script>
		<title>修改登录密码</title>		
		<style type="text/css">
			header {
				padding: 15px 20px 5px 20px;
				background-color: red;
				color: white;
				margin-top: 0px;
			}			
			#form {
				margin-top: 30px;
				line-height: 44px;
				padding: 0px 20px 0px 20px;
			}
			
			#yzm {
				height: 39px;
				width: 198px;
				border: 0px solid;
			}
			
			#new-password1 {
				height: 39px;
				width: 198px;
				border: 0px solid;
			}
			
			#new-password2 {
				height: 39px;
				width: 198px;
				border: 0px solid;
			}
			
			hr {
				margin-top: 5px;
				border: 1px solid #E5E5E5;
			}
			
			#bottom-txt-style {
				margin-top: 10px;
			}
			
			#bootm-txt {
				font-size: 13px;
				/*控制最下面的文字*/
			}
		</style>
	</head>

	<body>
		<div id="app">
			<header>
				<van-row>
					<van-col span="4" >
						<span @click="goBack"><返回</span>
					</van-col>
					<van-col span="17">修改昵称</van-col>	
					<van-col span="3" >
						<span @click="confirm">确认</span>
					</van-col>					
				</van-row>			
			</header>
			<!--头部结束-->		

			<section>
				<div style="height: 13px; background-color: #E5E5E5;"></div>
				<van-row>
					<!--三个文本框开始-->
					<div id="form">
						<van-col span="24">
							您当前昵称为：{{name}}
						</van-col>
						
						<van-col span="24">
							<hr/>
						</van-col>
						<van-col span="24">
							<input type="text" name="" id="new-password1" v-model="newname" placeholder="请输入新昵称" />
						</van-col>
						<van-col span="24">
							<hr/>
						</van-col>
					</div>
				</van-row>
				<!--三个文本框结束-->

				

			</section>
			
		</div>
		<script type="text/javascript">			
			var vm=new Vue({
				el:"#app",
				data:{
					key:localStorage.getItem("keys"),
					name:localStorage.getItem("name"),
					newname:""
				},			
				methods:{					
					goBack(){						
						var arr=plus.webview.currentWebview();							
						plus.webview.close(arr,"slide-out-right");
					},
					confirm(){
						vm.$dialog.confirm({						 
						  message: '确认修改吗？'
						}).then(() => {
						  ajax({
						  	url:"http://dsapi.ysd3g.com/API/ChangeNickName",
						  	data:{
						  		key:vm.key,
						  		nickName:vm.newname
						  	},
						  	dataType:"jsonp",
						  	success:function(res){
						  		if(res.Error==false){						  				
						  			localStorage.setItem("name",vm.newname);
						  			plus.webview.getWebviewById("grzx").reload(true);
									plus.webview.getWebviewById("personal").reload(true);
						  			plus.webview.currentWebview().reload(true);									
						  		}else{								
						  			vm.$toast.fail(res.Msg)									
						  		}
						  	}
						  })
						}).catch(() => {
						  vm.$toast("取消修改")	
						});				
						
					}
				}
			});
		</script>	
	</body>
</html>